using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    public class DynParamProcessElevator : DynParamProcessBase
    {
        public override EntityDynamicParamType paramType => EntityDynamicParamType.Elevator;
        public override bool isContainTriggerRect => true;

        public DynParamProcessElevator(LevelPlayRegionController regionCtrl) : base(regionCtrl)
        {
        }

        public override void OnEntityAddProcess(LevelPlayBaseEntity entity, BaseEntityDynamicParam currentParam, in IReadOnlyDictionary<EntityDynamicParamType, BaseEntityDynamicParam> paramMap)
        {
            var elvator = currentParam as EntityParamElevator;
            if (elvator == null)
            {
                return;
            }
            base.OnEntityAddProcess(entity, currentParam, paramMap);
            var elevatorComponent = entity.AddComponentWithPool<LevelElevatorComponent>(ETComponentType.LevelElevator, out var isCreate);
            if (isCreate)
            {
                elevatorComponent.InitElevatorEntity(elvator);
            }
        }
    }
}
